package com.jt.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//默认条件下使用iso-8859-1的编码格式,所以中文一定乱码
@PropertySource(value="classpath:/properties/msg.properties",
                    encoding="UTF-8")
		
public class MsgConntroller2 {
  /**
   * 通过pro文件方式赋值
   */
	@Value("${msg.username2}")
	private String  username;	//用户名
	@Value("${msg.age2}")
	private Integer age;	
	
	@RequestMapping("/getMsg2")
	public String getMsg() {
		
		return "返回值结果:"+username+":"+age;
	}
}
